<?php 
// 启动session
session_start();

require_once('mysql.php');
$vname = $_POST['vname'];
$vpwd = $_POST['vpwd'];

// 查询
if($conn){
	$result = mysqli_query($conn,"SELECT * FROM user WHERE vname='$vname' AND vpwd='$vpwd'");
	$res = mysqli_fetch_array($result);
	if(isset($res)){
		// 获取插入行的id
		
		// 记录登录的id
		$_SESSION['vname'] = $res['vname'];
		$_SESSION['phone'] = $res['phone'];
		$_SESSION['address'] = $res['address'];
		
		header('location:VCenter.php');

	}else{
		exit('错误：用户不存在。<a href="javascript:history.back(-1);">返回</a>');
	}
}

 ?>